//
//  STLoadingViewController.m
//  赛拓
//
//  Created by 王磊 on 7/31/16.
//  Copyright © 2016 立金所. All rights reserved.
//

#import "STLoadingViewController.h"

@interface STLoadingViewController ()<BDLoadingViewDelegate>

@end

@implementation STLoadingViewController

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    
    self.loadingView.loadingStatus = BDLoadingStatusSuccess;
    
}
- (void)initSubviews {
    [super initSubviews];
    
    [self setLoadingView];
}
- (void)setLoadingView {
    BDLoadingView *loadingView = [BDLoadingView loadingView];
    self.loadingView = loadingView;
    loadingView.delegate = self;
    loadingView.loadingStatus = BDLoadingStatusLoading;
}
- (void)loadingView:(BDLoadingView *)loadingView onListenLoadingStatus:(BDLoadingStatus)status {
    
    switch (status) {
        case BDLoadingStatusInternetConnectionFailure:
            
            [self loadData];
            
            break;
        case BDLoadingStatusFailure:
            
            [self loadData];
            
            break;
        default:
            break;
    }
}
- (void)onBackItemClick {
    
    if (self.navigationController.childViewControllers.count == 1) {
        
        [self dismissViewControllerAnimated:true completion:nil];
        
    } else {
        
        [self.navigationController popViewControllerAnimated:true];
    }
}

@end
